//https://leetcode.cn/problems/powx-n/
class Solution {
public:
    double myPow(double x, int n) 
    {
        return n>0?pow(x,n): 1/pow(x,n);
    }
    double pow(double x, int n)
    {
        if(n==0)
            return 1;
        double tmp=pow(x,n/2);
        return (n%2==0)?tmp*tmp:(tmp*tmp*x);
    }
};